import { defineStore } from 'pinia'
import { ref, reactive } from 'vue'

let settingStore = defineStore('setting', () => {
  const msgBox = ref(false) // 规则之后的提示框
  const refsh = ref(false) // 刷新
  const downOptions = ref(false) // playback 列表选项
  const VAindex = ref(1) // VA 索引
  const playInfo = reactive({
    data: {}
  }) // 视频播放信息，当前播放秒数 / 第几段视频
  const showBox = () => {
    msgBox.value = true
    if(msgBox.value){
      setTimeout(() => {
        hideBox()
      }, 2000);
    }
  }
  const hideBox = () => {
    msgBox.value = false
  }
  const setDownOptions = (val) => {
    downOptions.value = val
  }
  const setVAindex = (val) => {
    console.log('val',val)
    VAindex.value = val
  }
  const setPlayInfo = (msg) => {
    playInfo.data = msg
  }
  return {
    msgBox,
    refsh,
    downOptions,
    VAindex,
    playInfo,
    showBox,
    hideBox,
    setDownOptions,
    setVAindex,
    setPlayInfo
  }
})

export default settingStore